﻿using System.Windows.Forms;

namespace PictureApp
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();

            if (facebookService1 == null) return;
            CheckFacebookConnectionInformation();
            var notificationsList = facebookService1.Notifications.GetList(null, false);

            MessageBox.Show(notificationsList.notifications.ToString());
        }

        private void CheckFacebookConnectionInformation()
        {
            if (Properties.Settings.Default.SessionKey == string.Empty && facebookService1.uid == 0)
            {
                facebookService1.ConnectToFacebook();
                Properties.Settings.Default.SessionKey = facebookService1.SessionKey;
                Properties.Settings.Default.Save();
                
            }
            else
            {
                facebookService1.uid = Properties.Settings.Default.uid;
                facebookService1.SessionKey = Properties.Settings.Default.SessionKey;
                
            }
        }
    }
}
